<template>
	<el-card shadow="never" header="数据迁移">
		<el-form :model="form" label-width="120px" label-position="left">
			<el-form-item label="数据类型" prop="dbType">
				<el-select v-model="form.dbType">
					<el-option v-for="item in options" :key="item.value" :label="item.label"
							   :value="item.value"></el-option>
				</el-select>
			</el-form-item>
			<el-form-item label="数据库名称" prop="oracleSchema">
				<el-input v-model="form.oracleSchema" placeholder="数据库名称" maxlength="50" size="50"></el-input>
			</el-form-item>
			<el-button type="primary" @click="submit">生成SQL</el-button>
		</el-form>
	</el-card>
</template>

<script>
export default {
	name: 'Change DataBase Type',
	data() {
		return {
			form: {
				dbType: '',
				oracleSchema: 'C##CYOAUSER'
			},
			options: [
				{value: "pg", label: 'PostgreSQL'},
				{value: "oracle", label: 'ORACLE'},
				{value: "mssql", label: 'MSSQL'},
				{value: "kb", label: '人大金仓V8'},
				{value: "dmdbms", label: '国产达梦'},
				{value: "oscar", label: '国产神通'}
			],
		}
	},
	methods:{
		async submit(){
			var res = await this.$API.system.dbUnit.getDbSqlFile.get(this.form);
			if (res.code == 200) {
				this.$message.success(res.message)
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		}
	}
}
</script>

<style>
</style>
